<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="./index.js"></script>
    <script>
        alert("head中嵌套的JS代码");
        alert("未成年禁止入内");
       
    </script>
</head>
<body>
    <h1 onclick="alert('h1被点击');console.log('控制台输出');">点我</h1>
    <script>
        console.log("body末尾的脚本标签");
        document.write("<h2>body末尾动态添加</h2>");
    </script>
</body>
</html>